<template>
	<view class="">
		<view class="comtop">
			<view class="comtxt">
				名企工作推荐
			</view>
			<img src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/enterprise_base_logo.png"  alt="" style="height: 80%;width: 60%;margin-top: 40rpx;" />
		</view>
		
		<view v-if="!comlist.length>0"class="empty-img" style="display: flex;flex-direction: column; align-items: center;justify-content: center;margin-top: 200rpx;">
			<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png" style="width: 400rpx; height: 300rpx;margin-bottom: 50rpx;"></image>
			<label>暂无内容</label>
		</view>
		
		<view class="com-contain" v-for="(item,index) in comlist" :key="item.id" @click='navToinfo(item)'>
			<view class="" style="display: flex;">
				<view class="com-avatar">
					<image :src="item.cloge ? item.cloge : 'http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/default-avatar.png'" mode="" style="width: 100%; height: 100%;"></image>
				</view>
				<view class="com-containtxt">
					<view class="tptxt"><text>{{item.cname}}</text></view>
					<text class="bmtxt">{{item.cnature?item.cnature:''}} {{item.cindustry&&item.cnature? '|' : ''}} {{item.cindustry?item.cindustry:''}} {{item.remark1? '|' : ''}} {{item.remark1?item.remark1:''}}</text>
				</view>
			</view>
			<view class="bgview" v-for="(jobitem,index2) in item.jobList" :key="jobitem.id">
				<view class="topview">
					<view class="top-left"><label class="lab-item-left"><span>{{jobitem.title}}</span></label></view>
					<view v-if="jobitem.salaryMax" class="top-right"><label
							class="lab-item-right">{{formatSalary(jobitem.salaryMin)}}~{{formatSalary(jobitem.salaryMax)}}{{jobitem.unit}}</label>
					</view>
					<view  v-else-if="!jobitem.salaryMax&&!jobitem.salaryMin" class="top-right">
						<label class="lab-item-right">面议</label>
					</view>
					<view v-else class="top-right"><label class="lab-item-right">{{formatSalary(jobitem.salaryMin)}}{{jobitem.unit}}</label></view>
				</view>
				<view class="tag_container" v-if="jobitem.welfares">
					<view class="" v-for="(itembq) in jobitem.welfares.split(',')" style="background-color: #E4F0FF;padding: 4rpx 8rpx; font-size: 28rpx;margin-left: 20rpx;border-radius: 5rpx;margin-bottom: 20rpx;">
						{{itembq}}
					</view>
				</view>
				<!-- <view class="tag_container" v-if="data.welfares">
					<zyTag ref="zyAddTag" v-for="(item) in getTagList(data)" :text="item" addible />
				</view> -->
			</view>
			<view v-if="item.jobCount > 3" class="morejob" style="display: flex;width: 100%;justify-content: center;color: #a1a1a1;font-size: 24rpx;">
				<text>更多在招职位</text>
			</view>
		</view>
		<view class="" style="height: 5vh;">
			
		</view>
		<!-- <view v-if="!isonReachBottom"  style="text-align: center; color: #333; line-height: 100rpx; background: #f3f3ff;">没有更多了...</view> -->
	</view>
	
</template>

<script>
	//已注册企业
	import Index from "@/common/index-model.js"	
	import fun from '@/common/publicFun.js'
	// import zyTag from '@/components/zy-tag/zy-tag.vue'
	let index = new Index()
	let that = null
	export default {
		data() {
			return {
				comlist:[],
				ps:10,
				pn:0,
				isonReachBottom:true
			}
		},
		onLoad() {
			this.getcompany()
		},
		onPullDownRefresh() {
			this.getcompany()
		  },
		onReachBottom() {
			if(this.isonReachBottom&&this.comlist.length >= 10){
				console.log(this.isonReachBottom)
				this.getcompany()
			}
			
		},
		methods: {
			//页面跳转
			navToinfo(e) {
				let famous = JSON.stringify(e);
				index.navigate_to(`/pagesC/compyinfo/index?index=` + famous +'&&istg=2&&bartype=1')
			},
			formatSalary(salaryMin) {
			  if (salaryMin >= 10000) {
			    return (salaryMin / 10000) + '万';
			  } else if (salaryMin >= 1000) {
			    return (salaryMin / 1000) + '千';
			  } else {
			    return salaryMin ;
			  }
			},
			getcompany(){
				index.getPublicUserMember({
					pageSize:this.ps,
					pageNo:this.pn
					// pageSize:100,
					//  pageNo:0,
				},'client/famousEnterprise/list','get',res=>{
					if(res.data.code == 200 && res.data.success){
						console.log("请求数据->",res.data.result.records) 
						if(this.comlist.length != res.data.result.records.length){
							this.ps += 10
						}else{
							this.isonReachBottom = false
						}
						this.comlist = res.data.result.records
						uni.stopPullDownRefresh();
					}else{
						console.log("请求失败") 
						uni.stopPullDownRefresh();
					}
				})
				console.log("请求数据",this.comlist)
			},
		}
	}
</script>

<style>
	@import url("index.css");
	page{
		width: 100%;height: 100%;background-color: #efefef;
	} 
</style>
<style lang="scss">
	.tag_container {
		display: flex;
		align-items: center;
		flex-direction: row;
		flex-wrap: wrap;
	}
	.bgview {
		background-color: white;
		display: flex;
		flex-direction: column;
	
		.topview {
			margin-top: 28rpx;
			display: flex;
			flex-direction: row;
			height: 30px;
	
			.top-left {
				background-color: white;
				width: 50%;
				display: flex;
				justify-content: flex-start;
				padding-left: 10px;
				align-items: center;
	
				// justify-items: center;
				.lab-item-left {
					font-family: PingFang SC-Bold;
					font-weight: bold;
					text-align: left;
					font-size: 34rpx;
					color: #0F0F0F;
					margin-bottom: 8px;
					display: -moz-box;
					-moz-line-clamp: 1;
					-moz-box-orient: horizontal;
					overflow-wrap: break-word;
					word-break: break-all;
					white-space: nowrap; //不换行
					text-overflow: ellipsis; //超出部分省略号
					overflow: hidden;
				}
			}
	
			.top-right {
				// background-color: goldenrod;
				background-color: white;
				width: 50%;
				display: flex;
				justify-content: flex-end;
				padding-right: 10px;
				text-align: center;
				align-items: center;
	
				// justify-items: center;
				.lab-item-right {
					
					font-family: PingFang SC-Bold;
					text-align: right;
					font-size: 32rpx;
					color: #FF4800;
					margin-bottom: 8px;
					display: -moz-box;
					-moz-line-clamp: 1;
					-moz-box-orient: vertical;
					overflow-wrap: break-word;
					word-break: break-all;
					white-space: normal;
					overflow: hidden;
				}
			}
		}
	}
</style>